package com.huaxin.device.dto.enums.validator;

import com.huaxin.device.dto.enums.InsulationLevel;
import com.huaxin.device.dto.enums.validation.ValidInsulationLevel;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class InsulationLevelValidator implements ConstraintValidator<ValidInsulationLevel, String> {
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if (value == null || value.trim().isEmpty()) {
            return true;
        }
        return InsulationLevel.isValid(value);
    }
}